In virtualized systems, virtual machines run in virtualization softwares such as a hypervisor (e.g., VMware ESX Server™, Microsoft Hyper-V™, etc.). Virtualization softwares provide functionality to disassociate virtual machines from the underlying hardware by providing virtualized devices and resources to virtual machines. For example, a virtual machine is provided with a virtual disk, which appears to the operating system or applications running in the virtual machine as a real hard drive.
A virtual disk can be configured to be a thin virtual disk or a thick virtual disk. In case of a thick virtual disk of a certain size, the virtualization software allocates the full amount of storage in the underlying real hard drive or any other type of underlying physical storage. For example, if a virtual disk is configured to be of size 10 GB, full 10 GB space is allocated in the underlying physical storage right in the beginning. On the other hand, in case of a thin virtual disk of size 10 GB (for example), the virtualization software typically allocates a small storage to begin with, in the underlying physical storage. More physical storage is allocated to the thin virtual disk as needed. Hence a thin virtual disk can provide space savings on a physical disk or storage because the actual physical space occupied by a think disk generally includes only those blocks that have been written at least once since the virtual disk's creation.
Unfortunately, guest software running inside of a virtual machine using thin virtual disks can negate those space savings by writing temporary data. When this data is written to a block location never written before, it causes the thin virtual disk to grow in size. Later, when the guest software deletes the data, the thin disk does not shrink because the thin disk is unaware that the blocks are no longer used by the guest. This behavior can therefore cause thin disks to occupy more space on physical disks or storage than they need to occupy.